﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:local="clr-namespace:ScrumSprintMonitor.UI.Wpf"
    xmlns:MonitorWindow="clr-namespace:ScrumSprintMonitor.UI.Wpf.Views.MonitorWindow" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:Class="ScrumSprintMonitor.UI.Wpf.Views.MonitorWindow.SprintOverviewChart"
    mc:Ignorable="d" d:DesignHeight="250">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="..\..\Styles\ChartResourceDictionary.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <local:XamlServiceLocator x:Key="serviceLocator" />
        </ResourceDictionary>
    </UserControl.Resources>

    <UserControl.DataContext>
        <Binding Path="SprintHoursChartViewModel.PieChartData" Source="{StaticResource serviceLocator}"/>
    </UserControl.DataContext>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="4*"/>
            <RowDefinition Height="2*"/>
        </Grid.RowDefinitions>

        <charting:Chart Style="{DynamicResource PieChartStyle}">
        	<charting:PieSeries ItemsSource="{Binding}" IndependentValueBinding="{Binding Path=StateName}" DependentValueBinding="{Binding Path=Value}" />
        </charting:Chart>

        <Viewbox Grid.Row="1" VerticalAlignment="Top">
            <MonitorWindow:ChartLegend DataContext="{Binding}" HorizontalAlignment="Center" Margin="30, 10" Foreground="White" />
        </Viewbox>
    </Grid>
</UserControl>
